import config from 'config'
import httpFetch from 'share/httpFetch'
import errorMessage from "share/errorMessage";

export default {

  //获取表格数据
  getTableData(keyword, page) {
    return new Promise(((resolve, reject) => {
      httpFetch.get(`${config.baseUrl}/api/company/bank/with/order/page?keyword=${keyword}&page=${page}&size=10`)
        .then(res => {
          resolve(res);
        }).catch(err => {
        errorMessage(err.response);
        reject(err)
      })
    }));
  },

  enableStatus(id){
    return new Promise(((resolve, reject) => {
      httpFetch.post(`${config.baseUrl}/api/company/bank/with/order`, id)
        .then(res => {
          resolve(res);
        }).catch(err => {
        errorMessage(err.response);
        reject(err)
      })
    }));
  },

  disableStatus(id){
    return new Promise(((resolve, reject) => {
      httpFetch.delete(`${config.baseUrl}/api/company/bank/with/order`, id)
        .then(res => {
          resolve(res);
        }).catch(err => {
        errorMessage(err.response);
        reject(err)
      })
    }));
  },
}
